/*
 * @Author: WangLi
 * @Date: 2021-08-09 23:03:38
 * @LastEditors: WangLi
 * @LastEditTime: 2024-05-01 09:07:31
 * @Description:
 */
const USER_INFO = "userInfo";
export function getUser() {
  return wx.getStorageSync(USER_INFO) || null;
}

export function setUser(data) {
  wx.setStorageSync(USER_INFO, { ...data });
}

export function removeUser() {
  wx.removeStorageSync(USER_INFO);
}

const DEVICE = "device";
export function getDevice() {
  return wx.getStorageSync(DEVICE) || [];
}

export function setDevice(data) {
  wx.setStorageSync(DEVICE, [...data]);
}

export function removeDevice() {
  wx.removeStorageSync(DEVICE);
}

const LAST_CONNECTED_DEVICE = "last_connected_device";
export function getLastConnectedDevice() {
  return wx.getStorageSync(LAST_CONNECTED_DEVICE) || [];
}

export function setLastConnectedDevice(data) {
  wx.setStorageSync(LAST_CONNECTED_DEVICE, { ...data });
}

export function removeLastConnectedDevice() {
  wx.removeStorageSync(LAST_CONNECTED_DEVICE);
}
